/*
 * @Author: wangyongcun
 * @Date: 2023-02-21 19:53:05
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-06-08 18:38:56
 * @Description: 权限管理-接口定义和函数集合
 */
import { Request } from "@/utils/axios";

// 权限点类型
export const platformIdOptions = [
    {
        value: 1,
        label: "管理系统",
        children: [
            {
                value: 1,
                label: "页面",
            },
            {
                value: 2,
                label: "功能点",
            },
        ],
    },
    {
        value: 2,
        label: "小程序/H5",
        children: [
            {
                value: 1,
                label: "页面",
            },
            {
                value: 2,
                label: "功能点",
            },
        ],
    },
    {
        value: 3,
        label: "场地数据",
    },
    {
        value: 4,
        label: "课程数据",
    },
];

// ** 表头定义
export const tableColumn = [
    {
        prop: "id",
        label: "权限包ID",
        minWidth: "180",
    },
    {
        prop: "packageName",
        label: "权限包名称",
        minWidth: "180",
    },
];

/**
 * @description: 添加权限包 
 * @param {*} params
 * @return {*}
 */
export const addRequest = async (params) => {
    return Request.post("/teaching-organization/permission/addPermissionPackage", params, {
        headers: {
            autoTip: "fail",
        },
    });
};

/**
 * @description: 更新用户信息
 * @param {*} params
 * @return {*}
 */
export const updateRequest = async (params) => {
    return Request.post("/teaching-organization/person/updatePerson", params, {
        headers: {
            autoTip: "fail",
        },
    });
};

/**
 * @description: 删除权限包
 * @param {*} params
 * @return {*}
 */
export const deleteRequest = async (params) => {
    return Request.post("/teaching-organization/permission/deletePermissionPackage", params, {
        headers: {
            autoTip: "fail",
        },
    });
};

/**
 * @description: 获取权限包列表
 * @param {*} params
 * @return {*}
 */
export const queryListRequest = async (params) => {
    console.log(params, "paramsparams")
    return Request.get("/teaching-organization/permission/queryPermissionPackage", { params: params }, {
        headers: {
            autoTip: "fail",
        },
    });
};


// 新增权限包   

export const addPermissionPackageRequest = async (params) => {
    return Request.post("/teaching-organization/permission/addPermissionPackage", params, {
        headers: {
            autoTip: "fail",
        },
    });
};


// 获取权限包详情
export const queryPermissionPackageDetailByPackageIdRequest = async (params) => {
    return Request.post("/teaching-organization/permission/queryPermissionPackageDetailByPackageId", params, {
        headers: {
            autoTip: "fail",
        },
    });
};

/**
 * @description: 新增权限点
 * @param {*} params
 * @return {*}
 */
export const addPermissionPointRequest = async (params) => {
    return Request.post("/teaching-organization/permission/addPermission", params, {
        headers: {
            autoTip: "fail",
        },
    });
};

// 删除权限点
export const deletePermissionPointRequest = async (params) => {
    return Request.post("/teaching-organization/permission/deletePermission", params, {
        headers: {
            autoTip: "fail",
        },
    });
};

/**
 * @description: 获取权限点列表
 * @param {*} params
 * @return {*}
 */
export const getPermissionPointListRequest = async (params) => {
    return Request.get("/teaching-organization/permission/queryPermissionTree", { params: params }, {
        headers: {
            autoTip: "fail",
        },
    });
};

